<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Global</title>
</head>
<body>
<script>
/*
var str = "传智播客";
var encode = encodeURI(str);
document.write(encode + "<br>" );
//就是将字符转化为URL编码格式 , 就是%加2个字符的格式(字符用的是16进制)
document.write(decodeURI(encode)+"<br>");
//把uri编码转化为字符

var encode1 = encodeURIComponent(str);
document.write(encode1 + "<br>" );
//就是将字符转化为URL编码格式 , 就是%加2个字符的格式(字符用的是16进制)
document.write(decodeURIComponent(encode1)+"<br>");
//把uri编码转化为字符,其实这2个方法是差不多的,就是后面的这个方法转化的字符多一点
*/

var str = "123";
var number = parseInt(str);
document.write((number+1) + "<br>" );
//返回124
var str2 = "123abc";
var number2 = parseInt(str2);
document.write((number2+1) + "<br>" );
//返回124
var str3 = "a123";
var number3 = parseInt(str3);
document.write((number3+1) + "<br>" );
//返回NaN

</script>
</body>
</html>